<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			let array=[]
			function say(){
				let username=document.getElementById("username").value
				let speak=document.getElementById("speak").value
				let str="["+username+"]说："+speak+"!"
				// let str2=`[${username}]说:${speak}!`
				array.unshift(str)
				if(array.length>10){
					array.pop()
				}
				document.getElementById("all").innerText=array.join("\n")
			}
			function clear(){
				document.getElementById("username").value=""
				document.getElementById("speak").value=""
				document.getElementById("all").value=""
			}
		</script>
	</head>
	<body>
		姓名：<input type="text" id="username"><br>
		留言：<textarea rows="5" cols="20" id="speak" style="vertical-align: middle; resize: none" ></textarea><br>
		<button type="button" onclick="clear()">重置</button>
		<button type="button" onclick="say()">留言</button><hr>
		<textarea rows="8" cols="40" id="all" style="resize: none;" disabled="disabled"></textarea>
	</body>
</html>
